package com.waitingresult.mq;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;

/**
 * All right reserved,Designed By WangShuai
 * <p>
 *
 * @author : WangShuai
 * @version : V1.0
 * @ClassName : Producer
 * @Description :
 * @date : 2021/9/28 14:26
 */
@Component
public class Producer {
    @Resource
    private RabbitTemplate rabbitTemplate;

    public void produce() {
        String message = new Date() + "Beijing";
        System.err.println("生产者生产消息=====" + message);
        rabbitTemplate.convertAndSend("rabbitmq_queue", message);
    }
}
